<admintpl file="header" />
<body class="J_scroll_fixed">
	<style>
.pop_nav {
	padding: 0px;
}

.pop_nav ul {
	border-bottom: 1px solid #266AAE;
	padding: 0 5px;
	height: 25px;
	clear: both;
}

.pop_nav ul li.current a {
	border: 1px solid #266AAE;
	border-bottom: 0 none;
	color: #333;
	font-weight: 700;
	background: #F3F3F3;
	position: relative;
	border-radius: 2px;
	margin-bottom: -1px;
}
</style>
	<div class="wrap J_check_wrap">
		<admintpl file="nav" />
		<div class="pop_nav">
			<ul class="J_tabs_nav">
				<li class="current"><a href="javascript:;;">选择云存储</a></li>
				<li class=""><a href="javascript:;;">七牛设置</a></li>
				<li class=""><a href="javascript:;;">阿里云OSS设置</a></li>
			</ul>
		</div>
		<form class="J_ajaxForms" name="myform" id="myform" action="{:u('cloud/change')}" method="post">
			<div class="J_tabs_contents">
				<div>
					<div class="table_list">
						<table cellpadding="0" cellspacing="0" class="table_form" width="100%">
							<tbody>
<!-- 								 -->
<tr>
	<td>是否使用</td>
	<td>
		<input type="text" class="input" name="status" value="{$config.status}">
		<span class="must_red">status</span>
	</td>
</tr>
								<tr>
									<td>模版方案：</td>
									<td>
<select name="use" class="normal_select" >
	<foreach name="config.cloud_list" item="val" key="key">
	<if condition="$key == $config['use']">
	<option value="{$key}" selected>{$val}</option>
	<else />
	<option value="{$key}">{$val}</option>
	</if>
	</foreach>
</select>
<span class="must_red">use</span>
									</td>
								</tr>
<tr>
	<td>七牛AK</td>
	<td>
		<input type="text" class="input" name="qn_ak" value="{$config.qn_ak}">
		<span class="must_red">qn_ak</span>
	</td>
</tr>
<tr>
	<td>七牛SK</td>
	<td>
		<input type="text" class="input" name="qn_sk" value="{$config.qn_sk}">
		<span class="must_red">qn_sk</span>
	</td>
</tr>
<tr>
	<td>七牛Bucket</td>
	<td>
		<input type="text" class="input" name="qn_default_bucket" value="{$config.qn_default_bucket}">
		<span class="must_red">qn_default_bucket</span>
	</td>
</tr>
<tr>
	<td>阿里云OSS AK</td>
	<td>
		<input type="text" class="input" name="oss_ak" value="{$config.oss_ak}">
		<span class="must_red">oss_ak</span>
	</td>
</tr>
<tr>
	<td>阿里云OSS SK</td>
	<td>
		<input type="text" class="input" name="oss_sk" value="{$config.oss_sk}">
		<span class="must_red">oss_sk</span>
	</td>
</tr>
<tr>
	<td>阿里云bucket</td>
	<td>
		<input type="text" class="input" name="oss_default_bucket" value="{$config.oss_default_bucket}">
		<span class="must_red">oss_default_bucket</span>
	</td>
</tr>

<!--  -->

							</tbody>
						</table>
					</div>


				</div>
				<div style="display: none">
					<div class="table_list">
						<table cellpadding="0" cellspacing="0" class="table_form"
							width="100%">
							<tbody>

							</tbody>
						</table>
					</div>
				</div>
				<div style="display: none">
					<div class="table_list">
						<table cellpadding="0" cellspacing="0" class="table_form" width="100%">
							<tbody>
								
							</tbody>
						</table>
					</div>


				</div>
			</div>
			<div class="btn_wrap">
		      <div class="btn_wrap_pd">
		        <button class="btn btn_submit mr10 J_ajax_submit_btn" type="submit">提交</button>
		      </div>
		    </div>
		</form>
	</div>
	<script type="text/javascript" src="__ROOT__/statics/js/common.js{$js_debug}"></script>
	<script>
/////---------------------
	 Wind.use('validate', 'ajaxForm', 'artDialog', function () {
			//javascript
	        var form = $('form.J_ajaxForms');
	        //ie处理placeholder提交问题
	        if ($.browser.msie) {
	            form.find('[placeholder]').each(function () {
	                var input = $(this);
	                if (input.val() == input.attr('placeholder')) {
	                    input.val('');
	                }
	            });
	        }
	        //表单验证开始
	        form.validate({
				//是否在获取焦点时验证
				onfocusout:false,
				//是否在敲击键盘时验证
				onkeyup:false,
				//当鼠标掉级时验证
				onclick: false,
	            //验证错误
	            showErrors: function (errorMap, errorArr) {
					//errorMap {'name':'错误信息'}
					//errorArr [{'message':'错误信息',element:({})}]
					try{
						$(errorArr[0].element).focus();
						art.dialog({
							id:'error',
							icon: 'error',
							lock: true,
							fixed: true,
							background:"#CCCCCC",
							opacity:0,
							content: errorArr[0].message,
							cancelVal: '确定',
							cancel: function(){
								$(errorArr[0].element).focus();
							}
						});
					}catch(err){
					}
	            },
	            //验证规则
	            // rules: {'options[site_name]':{required:1},'options[site_host]':{required:1},'options[site_root]':{required:1}},
	            // //验证未通过提示消息
	            // messages: {'options[site_name]':{required:'请输入网站名称！'},'options[site_host]':{required:'请输入网站域名！'},'options[site_root]':{required:'请输入安装路径！'}},
	            //给未通过验证的元素加效果,闪烁等
	            highlight: false,
	            //是否在获取焦点时验证
	            onfocusout: false,
	            //验证通过，提交表单
	            submitHandler: function (forms) {
	                $(forms).ajaxSubmit({
	                    url: form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
	                    dataType: 'json',
	                    beforeSubmit: function (arr, $form, options) {
	                        
	                    },
	                    success: function (data, statusText, xhr, $form) {
	                        if(data.status){
								setCookie("refersh_time",1);
								//添加成功
								Wind.use("artDialog", function () {
								    art.dialog({
								        id: "succeed",
								        icon: "succeed",
								        fixed: true,
								        lock: true,
								        background: "#CCCCCC",
								        opacity: 0,
								        content: data.info,
										button:[
											{
												name: '确定',
												callback:function(){
													return true;
												},
												focus: true
											},{
												name: '关闭',
												callback:function(){
													return true;
												}
											}
										]
								    });
								});
							}else{
								alert(data.info);
							}
	                    }
	                });
	            }
	        });
	    });
	////-------------------------
	
	
	</script>
</body>
</html>